package com;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.util.List;


@SpringBootApplication
public class Application {
	
	//private static Logger log = LoggerFactory.getLogger(Application.class) ;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
		cpu();
    }
    
    public static String cpu() {
    	List<GarbageCollectorMXBean> beans = ManagementFactory.getGarbageCollectorMXBeans();
    	StringBuffer sb = new StringBuffer();
    	for (GarbageCollectorMXBean b : beans) {
			sb.append(b.getName()+" -- ");
		}
    	System.out.println(sb.toString());
    	return sb.toString();
    }
    
//    @RequestMapping("jvmgc")
//    @ResponseBody
//    public String jvmgc() {
//    	int i = 0;
//    	while (true) {
//    		try {
//				Thread.sleep(10);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
//    		byte [] tem = new byte[10240];
//    		i++;
//    		tem[0]= 127;
//    		if (i % 100 == 0) {
//    			System.out.println(tem.toString()+" *** "+(i));
////    			if (i % 2000 == 0) {
////    				System.out.println("调用gc");
////					System.gc();
////				}
//			}
//    		
//    		tem = null;
//    		
//		}
//    }
}
